var barcode = require('./barcode')
var qrcode = require('./qrcode')

function convert_length(length) {
  return Math.round(wx.getSystemInfoSync().windowWidth * length / 750);
}

function barc(id, code, width, height) {
  barcode.code128(wx.createCanvasContext(id), code, convert_length(width), convert_length(height))
}

function qrc(code, id, width, height) {
  qrcode.api.draw(code, id, convert_length(width), convert_length(height));
}
module.exports = {
  barcode: barc,
  qrcode: qrc
}